$(function() {
  $.initPage(eLancoSelectType.load.start);
});

var eLancoSelectType = new BaseFrame();

eLancoSelectType.addBlock('select');

//load module
eLancoSelectType.load.addStart(function() {
  $.pageStart(_eLancoSettings);
  eLancoSelectType.load.runTask();
});

eLancoSelectType.load.addBind('createTitle', function() {
  var currentPage = $.getCurrentPage(_eLancoSettings.pageList);
  $('title').text(currentPage.title);
});

eLancoSelectType.load.addBind('createNav', function() {
  var navList = $.getUserAuthorityList(_user.roleList, _eLancoSettings.authorityList, _eLancoSettings.pageList);
  $('#logout').on('click', $.logoff);
  $('#block-nav').createNavList(navList).removeClass('dn');
});

eLancoSelectType.load.select.addBind('createSelectList', function() {
  for(var i = 0; i < TypeList.length; i++){
    var typeItem = TypeList[i];
    if(!typeItem.isActivity) continue;
    var ItmeHtml =$('<div>').addClass('type-item').append($('<a>').attr('href', typeItem.href)
    .append($('<img>').attr('src', typeItem.icon))
    .append($('<div>').addClass('type-title')
    .append($('<h3>').text(typeItem.title))
    .append($('<h5>').text(typeItem.englishTitle))));
    if(!typeItem.isActivity || $.isEmpty(typeItem.href)){
      ItmeHtml.find('a').addClass('btn disabled');
    }
    $('#block-select').append(ItmeHtml);
  }
});